﻿Imports DTO
Imports DataAccess

Public Class BSOrganization

    Public Sub New(ByVal serverName As String)

        ' config server name
        DAOrganization.ConfigServerName(serverName)

    End Sub

    ''' <summary>
    ''' Get all Organization
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetOrganization() As DataTable

        Return DAOrganization.GetOrganization()

    End Function

    ''' <summary>
    ''' Add new organization
    ''' </summary>
    ''' <param name="dtoOrganization"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function AddOrganization(ByVal dtoOrganization As DTOOrganization) As Boolean



        If DAOrganization.AddOrganization(dtoOrganization) <> 0 Then

            Return True

        Else

            Return False

        End If


    End Function

    ''' <summary>
    ''' Update organization
    ''' </summary>
    ''' <param name="dtoOrganization"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function UpdateOrganization(ByVal dtoOrganization As DTOOrganization) As Boolean

        If DAOrganization.UpdateOrganization(dtoOrganization) <> 0 Then

            Return True

        Else

            Return False

        End If

    End Function


    ''' <summary>
    ''' Delete organization
    ''' </summary>
    ''' <param name="dtoOrganization"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function DeleteOrganization(ByVal dtoOrganization As DTOOrganization) As Boolean

        If DAOrganization.DeleteOrganization(dtoOrganization) <> 0 Then

            Return True

        Else

            Return False

        End If

    End Function


    ''' <summary>
    ''' Get organizations are company.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetCompany() As DataTable

        Return DAOrganization.GetCompany()

    End Function

    ''' <summary>
    ''' check organization still contain employee
    ''' </summary>
    ''' <param name="organNo"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function CheckOrganContainEmployee(ByVal organNo As String) As Boolean

        Dim i As Integer = DAOrganization.CheckOrganContainEmployee(organNo)

        If i > 0 Then

            Return True

        Else

            Return False

        End If

    End Function

End Class
